#!/bin/bash
PORTBEG=10001
PORTEND=`expr $PORTBEG + 10`

TESTMEDIAFILE=/opt/testMediaFiles/CCTV10.ts
# TESTMEDIAFILE=/opt/testMediaFiles/globo.ts
# TESTMEDIAFILE=/opt/testMediaFiles/recvems_20001.ts
# TESTMEDIAFILE=/opt/testMediaFiles/Avatar.ts
# TESTMEDIAFILE=/opt/testMediaFiles/xihu.flv

FFMPEGPATH=/opt/ThirdParty/opensource/ffmpeg-4.1.3


for PORT in `seq $PORTBEG $PORTEND`
do
{
	while true;do
		$FFMPEGPATH/bin/ffmpeg -re -i $TESTMEDIAFILE -c copy -f mpegts udp://127.0.0.1:$PORT?pkt_size=1316
	done
} &
done
wait  ##等待所有子后台进程结束
date

# 全部杀死:
# ps -axj | grep -v grep| grep -E "ffmpeg|uk_capture"  | awk '{print $2}' | xargs kill -9